<html>

<head>
<meta charset="UTF-8">
<title>审批提交</title>
</head>
<body>
	<#import "/page.ftl" as page />
	<link rel="stylesheet" type="text/css" href="/css/form.css">
	<script type="text/javascript" src="/js/apply.js"></script>
	<#include "/head.ftl"/>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<a href="/apply/submit/choosetype" title="添加申请" class="btn btn-setting btn-add" id="add"> <i class="iconfont icon-add"
					style="font-size: 16px;"></i>
				</a>
				<a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a>
				<form class="tab-tool" method="get" id="search">
					<select name="applyType" onchange="findByStatus1(this)">
						<option value="">所有状态</option>
						<#list status['apply'] as sa>
							<#if RequestParameters.state?? && RequestParameters.state?number==sa.value>
								<option value="${sa.value}" selected="selected">${sa.name}</option>
							<#else>
								<option value="${sa.value}">${sa.name}</option>
							</#if>
						</#list>
					</select>
					<input name="key" type="text" placeholder="按主题查找...">
					<button class="search-btn">
						<i class="iconfont icon-search"></i>
					</button>
				</form>
			</div>
			<div class="tab-content">
				<div>
					<table style="width: 100%; border-collapse: collapse;">
						<tr>
							<#assign sort=applys.sort?replace(': ',',') />
							<th>序号</th>
							<th>申请主题</th>
							<th>申请时间
								<#if sort=='time,DESC'>
									<a onclick="pageSort('${requestURI}','time')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='time,ASC' >
									<a onclick="pageSort('${requestURI}','time,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','time')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>申请状态
								<#if sort=='status,DESC'>
									<a onclick="pageSort('${requestURI}','status')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='status,ASC' >
									<a onclick="pageSort('${requestURI}','status,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','status')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>最新审批人</th>
							<th>操作</th>
						</tr>
						<#if applys.content?size gt 0>
							<#list (applys.content) as apply>
								<tr data-id="${apply.id}">
									<td>${apply_index+1}</td>
									<td>${apply.title}</td>
									<td>${apply.time}</td>
									<td>
										<#list status['apply'] as sa>
											<#if sa.value==apply.status><span class="label" style="background-color: ${sa.color}">${sa.name}</span></#if>
										</#list>
									</td>
									<td>${apply.deptOffice.name}</td>
									<td>
										<a href="/apply/show?id=${apply.id}" title="查看详情" class="btn btn-look"><i class="iconfont icon-search"></i><span> 查看详情</span></a>
										<!-- 只有在未审核状态才能修改和删除 -->
										<#if apply.status==0>
											<a href="/apply/submit/getone?id=${apply.id}" title="修改审批" class="btn btn-update"><i class="iconfont icon-brush"></i><span> 修改</span></a>
											<a onclick="deleteOne(${apply.id},'/apply/submit/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span> 删除</span></a>
										</#if>
									</td>
								</tr>
							</#list>
						<#else>
							<tr><td colspan="6">没有提交的申请可查看噢~快去 <a href="/apply/submit/choosetype" title="添加申请" style="text-decoration: underline;"> 添加申请 </a></tr>
						</#if>
					</table>
				</div>
			</div>
			<@page.page url=requestURI pager=applys/>
		</div>
	</div>
</body>
</html>